﻿using System;

namespace SharpTrainer.Objects
{
    [Serializable]
    public class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }

        public override string ToString()
        {
            string format = "Name: {0}\nAge: {1}\n";

            return string.Format(format, Name, Age);
        }
        
        public override bool Equals(object obj)
        {
            var entity = obj as Person;
            if (entity == null)
            {
                return false;
            }

            return entity.Name == this.Name
                && entity.Age == this.Age;
        }
    }
}
